﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;

namespace DTO
{
    public class TOPIC
    {
    #region Attributes
        private int _iIDTopic;
        private string _strName;
        #endregion

        #region Constuctor
        public TOPIC()
        {
            _iIDTopic = -1;
            _strName = "";            
        }
        #endregion

        #region Properties        
        public int idTopic
        {
            get { return _iIDTopic; }
            set { _iIDTopic = value; }
        }

        public string Name
        {
            get { return _strName; }
            set { _strName = value; }
        }       
        #endregion

        #region Methods
        public void LoadTopic(XmlNode node)
        {
            XmlNode nodeTemp;
                        
            nodeTemp = node.SelectSingleNode("idTopic");
            this._iIDTopic = Int32.Parse(nodeTemp.InnerText);

            nodeTemp = node.SelectSingleNode("Name");
            this._strName = nodeTemp.InnerText;

        }

        public void WirteXml(XmlTextWriter xw)
        {
            xw.WriteStartElement("Vocabulary");
            
            xw.WriteStartElement("idTopic");
            xw.WriteString(idTopic.ToString());
            xw.WriteEndElement();

            xw.WriteStartElement("Name");
            xw.WriteString(Name);
            xw.WriteEndElement();            

            xw.WriteEndElement();
        }
        #endregion
    }
}
